<?php
/**
 * Created by PhpStorm.
 * User: xaq
 * Date: 2017/7/17
 * Time: 10:18
 */

namespace app\index\model;

use think\Db;


class CallTable extends BaseModel
{
    protected $visible = ['StuID', 'StuStat'];

    public function setStuStatAttr($value)
    {
        if ($value == "0") {
            return '已到';
        } else if ($value == "1") {
            return '请假';
        } else {
            return '未到';
        }
    }
    //Get请求
    public static function getCallInfoList($data)
    {
        $resultList = Db::table('Call_table')
            ->field(['StuID','StuStat','Student_table.Name'])
            ->where([
                'CallTchID' => $data['teachID'],
                'CallTime' => $data['callTime'],
                'ClassID' => $data['classID']
            ])
            ->join('Student_table', 'StuID = Student_table.ID','LEFT')
            ->select();
        return $resultList;
    }
}